#!/usr/bin/python

from assistant_classify import Document
from assistant_classify import Music
from assistant_classify import Picture
from assistant_classify import Movie
import re
import os
class clear_classification(Document):
    def __init__(self):
        Document.__init__(self)
        music = Music()
        movie = Movie()
        picture = Picture()
        Document.look(self)
        music.look()
        movie.look()
        picture.look()
    def delet(self,values):
        map(lambda x : self.cu.execute("""delete from file_type where type_language="%s" """ %x  ),values)
        self.cx.commit()
        self.cx.close()

    def get_list(self):
        try:
            tem = raw_input("""input names : (example:  " txt page ")\n KeyboardInterrupt to exit : """)
        except KeyboardInterrupt:
            if (self.cx):
                self.cx.close()
            exit(0)
        name_list  = get_all(tem)
        name_list =map((lambda x: "." + x), name_list)
        print name_list
        return name_list
    def run (self):
        self.delet(self.get_list())

def get_all(string):
    com = re.compile('([a-zA-Z]{1,20}[345]{0,1})')
    return re.findall(com,string)

if __name__ == "__main__":
    manage = clear_classification()
    manage.run()
    os.system("clear")
    exit(0)
